import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import "./assets/font_2588161_d2sfioyphmi/iconfont.css"
//导入全局样式表
import './assets/global.css'
//导入echarts
import echarts from 'echarts'
//对axios进行全局配置
import axios from 'axios'
//为axios设置一个根路径
axios.defaults.baseURL = 'http://192.168.31.185:8080/'

axios.interceptors.request.use((config) => {
    if (window.sessionStorage.getItem("token")) {
        config.headers.Authorization =
            window.sessionStorage.getItem("token");
    }
    // 在最后必须return config
    return config;
});
//然后把这个包挂载到Vue的原型对象上
Vue.prototype.$http = axios //这样的话每一个Vue的组件都可以通过this直接访问到$http去发起ajax请求

Vue.config.productionTip = false
Vue.prototype.$echarts = echarts
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')


//重写提示框
// 解决了提示框一直弹出的问题
import { message } from './assets/resetMessage.js'
Vue.prototype.$message = message; //重写message提示框  一定要放在Vue.use(ElementUI)之后